﻿<UserControl x:Class="ConfigEditor.View.UserCtrlAllMeasurements"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="282" d:DesignWidth="393">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="auto"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="auto"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="1*"/>
            <ColumnDefinition Width="2*"/>
            <ColumnDefinition Width="1*"/>
            <ColumnDefinition Width="2*"/>
            <ColumnDefinition Width="1*"/>
        </Grid.ColumnDefinitions>

        <Label Grid.Row="0" Grid.Column="0" Content="Device: "/>
        <TextBox Grid.Row="0" Grid.Column="1"
                 Text="{Binding Path=DevSearchTxt}"/>
        <Label Grid.Row="0" Grid.Column="2" Content="SignalType: "/>
        <ComboBox Grid.Row="0" Grid.Column="3" 
                  ItemsSource="{Binding Path=SignalTypeOptions}"
                  SelectedItem="{Binding Path=CurrentSignalType}"/>
        <Button Grid.Row="0" Grid.Column="4" Content="Filter"
                Command="{Binding Path=FilterCmd}"/>


        <DataGrid Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="5" 
                  ItemsSource="{Binding Path=MeasurementsView}"
                  AlternatingRowBackground="LemonChiffon">
            <DataGrid.RowStyle>
                <Style TargetType="DataGridRow">
                    <Setter Property="IsSelected" Value="{Binding Path=IsSelectToAdd}" />
                </Style>
            </DataGrid.RowStyle>

            <DataGrid.Columns>
                <DataGridTextColumn Binding="{Binding Path=Key}" Header="Key" IsReadOnly="True"/>
                <DataGridTextColumn Binding="{Binding Path=SignalReference}" 
                                                Header="SignalReference" 
                                                Width="*"
                                                IsReadOnly="True"/>
                <DataGridTextColumn Binding="{Binding Path=SignalType}" 
                                                Header="SignalType" IsReadOnly="True"/>
                <DataGridTextColumn Binding="{Binding Path=PhasorType}" Header="PhasorType" 
                                                IsReadOnly="True" />
            </DataGrid.Columns>
            <DataGrid.GroupStyle>
                <GroupStyle>
                    <GroupStyle.Panel>
                        <ItemsPanelTemplate>
                            <DataGridRowsPresenter/>
                        </ItemsPanelTemplate>
                    </GroupStyle.Panel>
                    <GroupStyle.HeaderTemplate>
                        <DataTemplate>
                            <Label Content="{Binding Path=Name}" 
                                               Background="Pink"
                                               HorizontalContentAlignment="Center"
                                               FontSize="16"
                                               FontWeight="Black"/>
                        </DataTemplate>
                    </GroupStyle.HeaderTemplate>
                </GroupStyle>
            </DataGrid.GroupStyle>
        </DataGrid>
        <CheckBox Grid.Row="2" Grid.Column="0" Content="All"
                  Command="{Binding Path=SelectAllCmd}" />
        <Button Grid.Row="2" Grid.Column="4" Content="Select"
                Command="{Binding Path=AddCmd}"/>
    </Grid>
</UserControl>
